Skip to content

Have Uni return types on all Session opening methods #973 #983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 12, 2021

Conversation

DavideD
Copy link
Member

@DavideD DavideD commented Sep 30, 2021

Fixes #950
Superseeds #973

Instead of the previous approach of completely remove the existing methods for opening a session lazily, I've deprecated them.
The main reason is that we are having some issues with quarkus and by deprecating the method in the API we can still have a release of Hibernate Reactive and more flexibility about how to fix the integration with Quarkus.

The drawback is that we have to find a new name for the new method (and we cannot use the current name openSession).
I've opted for newSession instead but I'm open to suggestions.

As an alternative, I was thinking of prepareSession or prepareNewSession.IT might give a better idea that the returned value won't be an instance of Session.

@gavinking I think this is something you might want to have a look.

@DavideD
Copy link
Member Author

DavideD commented Sep 30, 2021

@Sanne, you should be able to test Quarkus with this branch without any additional changes but I'm preparing a branch Quarkus that uses the new API

@Sanne
Copy link
Member

Sanne commented Sep 30, 2021

you should be able to test Quarkus with this branch without any additional changes ...

Tested it, that worked fine.

but I'm preparing a branch Quarkus that uses the new API

Nice, let me know when you have something.

@gavinking
Copy link
Member

Look, I'm not keen on the idea that we're changing the name of a public API because of some transient integration issue.

If we really think newSession() is a better name, then OK, fine. To me it doesn't seem better.

@Sanne
Copy link
Member

Sanne commented Oct 1, 2021

@gavinking we're open to suggestions of course.

I did suggest newSession() because the other method one could use - withSession - does leverage the vertx context, which confused me initially as it might reuse some existing session in the context (which honestly surprised me).

So I think newSession nicely expresses the aspect that this one method actually guarantees it to be a new one. And this conveys a suggestion about when this is a good choice, as otherwise I'd normally always prefer to use withSession which IMO looks better when working with reactive.

Would you like to suggest some alternatives?

@gavinking
Copy link
Member

Well I was very happy with openSession() which to me also pretty unambiguously signals a new session, and is the naming that's used in Hibernate ORM.

@DavideD
Copy link
Member Author

DavideD commented Oct 1, 2021

createSession also works for me.

@DavideD
Copy link
Member Author

DavideD commented Oct 1, 2021

Or openSessionUni and openSessionStage

@Sanne
Copy link
Member

Sanne commented Oct 1, 2021

Well I was very happy with openSession() which to me also pretty unambiguously signals a new session, and is the naming that's used in Hibernate ORM.

while it's not legal in source code we can have both flavours of openSession() in the API; it needs a little tooling gymnastics to make it happen though, so I'd only do that if you feel it's important.

@gavinking
Copy link
Member

What I'm saying is I don't find your justification for not just removing the previous versions to be very convincing.

@gavinking
Copy link
Member

What I'm saying is I don't find your justification for not just removing the previous versions to be very convincing.

(It puts the cart before the horse.)

@Sanne
Copy link
Member

Sanne commented Oct 1, 2021

What I'm saying is I don't find your justification for not just removing the previous versions to be very convincing.

oh yes sure, we initially tried to remove it.

On the Quarkus side we're having two Panache tests failing for reasons we couldn't understand yet; we spent some days on this and that's why this is coming a week later than when we last discussed it - I then suggested to Davide that if it was possible to release another CR which had both methods, we could then upgrade Quarkus and migrate one module at a time - and bisect the problem, which is eluding us currently.

So another alternative is we try harded to figure it out on the Quarkus side :) if we solve that we could just delete them, but then also deprecating these would feel more like doing the right thing for the few users we already have.

@gavinking
Copy link
Member

Why don't you just add some method that Panache needs to the new Implementor interface and do a typecast in the Quarkus code?

@Sanne
Copy link
Member

Sanne commented Oct 1, 2021

Why don't you just add some method that Panache needs to the new Implementor interface and do a typecast in the Quarkus code?

brilliant :)

Thanks

@DavideD let's do that? It's not as nice to other users but will definitely help us move on.

@gavinking
Copy link
Member

gavinking commented Oct 1, 2021

It's not as nice to other users

I mean, to me it seems much better than releasing 1.0 with some operations on a public API that you're already planning on removing later.

@Sanne
Copy link
Member

Sanne commented Oct 1, 2021

I mean, to me tat seems much better than releasing 1.0 with some operations on a public API that you're already planning on removing later.

well to be clear I was going to make this another CR, and then remove it before tagging Final.

But sure let's use the Implementor instead.

@DavideD
Copy link
Member Author

DavideD commented Oct 8, 2021

I've updated this PR and moved the mehods required for Quarkus in the interface MutinyImplementor.
I've also created StageImplementor but decided to remove it because we don't need it in Quarkus.

@Sanne to make this work with Quarkus you need this commit: DavideD/quarkus@3807d77

The rest of the branch contains all the other changes we applied to Quarkus before that make everything work except for Panache

@DavideD DavideD merged commit a1028e1 into hibernate:main Oct 12, 2021
@DavideD DavideD deleted the deprecates-api branch October 12, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider forcing Uni return types on all Session opening methods
3 participants